package com.skysail.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.skysail.common.oauth.auth.SysUserAuthentication;
import com.skysail.common.util.ReturnMessage;
import com.skysail.model.primary.UserModel;
import com.skysail.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/")
public class LoginController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/login", method = RequestMethod.POST)
     public ReturnMessage login(String userName){
        ReturnMessage msg = new ReturnMessage();
        UserModel userModel = userService.findOne("yyyyy");

        msg.setStatus("001");
        try{
            msg.setRestulData(new ObjectMapper().writeValueAsString(userModel));
        }catch (Exception e){

        }
        msg.setMsg("登录成功");
        return msg;
     }

}
